package com.qk.common.enums;

/**
 *Date:2025/10/20
 *Author:zxc
 *Description
*/
public enum ClueEnum implements  Code{
    // 待分配（初始状态）
    WAIT_ALLOCATION(1, "待分配"),
    // 待跟进
    WAIT_TRACK(2, "待跟进"),
    // 跟进中
    TRACKING(3, "跟进中"),
    // 伪线索
    FALSE_CLUE(4, "伪线索"),
    // 转商机
    CONVERT_TO_BUSINESS(5, "转商机");

    private final int code;
    private final String msg;

    ClueEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    @Override
    public String getMsg() {
        return msg;
    }

    @Override
    public String getChars() {
        return "";
    }

    // 根据code获取枚举（数据库查出来的int转枚举）
    public static ClueEnum getByCode(int code) {
        for (ClueEnum state : values()) {
            if (state.getCode() == code) {
                return state;
            }
        }
        throw new IllegalArgumentException("无效的线索状态码：" + code);
    }
}
